﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SharpTRI
{
    class AngryBot : Bot
    {
        private Player mPlayer;
        private float AggreRange { get; set; }

        public AngryBot(float walkRange, float aggreRange, Player player)
            : base(walkRange)
        {
            AggreRange = aggreRange;
            Xors3D.xEntityColor(Mesh, 255, 0, 0);
            mPlayer = player;
        }

        public override void  Update()
        {
            if (!IsDead())
            {
                if (DistanceTo(mPlayer.Position) < AggreRange)
                {
                    Attack(mPlayer);
                    if (InPosition(mTarget.Position))
                    {
                        DealDamage(mTarget);
                    }
                }
                else
                {
                    mTarget = null;
                    Walk();
                }
                Move();
            }
            else
            {
                Xors3D.xEntityColor(Mesh, 50, 0, 0);
            }
        }
    }
}
